<!-- 结算类型 -->
<template>
    <div>
        <el-table
            ref="currencyTable"
            :data="tableData"
            stripe
            v-loading="loading"
            border
            style="width: 100%"
            @row-dblclick="getSelectVal"
        >
            <el-table-column type="selection" width="55" align="center">
            </el-table-column>
            <el-table-column
                type="index"
                width="55"
                label="序号"
                align="center"
            />
            <el-table-column prop="meteringUnitCode" label="计量单位编码">
                <template slot-scope="scope">{{
                    scope.row.meteringUnitCode || "--"
                }}</template>
            </el-table-column>
            <el-table-column prop="meteringUnitName" label="计量单位名称">
                <template slot-scope="scope">{{
                    scope.row.meteringUnitName || "--"
                }}</template>
            </el-table-column>
            <el-table-column prop="roundingType" label="舍入类型">
                <template slot-scope="scope">{{
                    scope.row.roundingType || "--"
                }}</template>
            </el-table-column>
            <el-table-column prop="meteringUnitDescribe" label="计量单位描述">
                <template slot-scope="scope">{{
                    scope.row.meteringUnitDescribe || "--"
                }}</template>
            </el-table-column>
            <el-table-column prop="defaultDegree" label="精度">
                <template slot-scope="scope">{{
                    scope.row.defaultDegree || "--"
                }}</template>
            </el-table-column>
            <el-table-column prop="exchangeDenominator" label="换算分母">
                <template slot-scope="scope">{{
                    scope.row.exchangeDenominator || "--"
                }}</template>
            </el-table-column>
            <el-table-column prop="exchangeNumerator" label="换算分字">
                <template slot-scope="scope">{{
                    scope.row.exchangeNumerator || "--"
                }}</template>
            </el-table-column>
            <el-table-column prop="exchangeType" label="换算类型">
                <template slot-scope="scope">{{
                    scope.row.exchangeType || "--"
                }}</template>
            </el-table-column>
        </el-table>
        <el-pagination
            class="pagination mt10"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="currentPage"
            :page-sizes="[10, 20, 30, 40]"
            :page-size="pageSize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="total"
            background
        >
        </el-pagination>
    </div>
</template>

<script>
import { getUnitData } from "@/api/base/data";
export default {
    data() {
        return {
            tableData: [],
            currentPage: 1, //当前页
            pageSize: 10, //每页条数
            total: 0,
            loading: false,
        };
    },
    methods: {
        //分页器size
        handleSizeChange(val) {
            this.pageSize = val;
            this.getDataList();
        },
        //分页器当前页
        handleCurrentChange(val) {
            this.currentPage = val;
            this.getDataList();
        },
        getSelectVal(val) {
            this.$emit("row-dblclick", val);
        },
        getDataList() {
            this.loading = true;
            let params = {
                pageNo: this.currentPage,
                pageSize: this.pageSize,
            };
            getUnitData(params).then((res) => {
                this.tableData = res.rows;
                this.total = res.total;
                this.loading = false;
            });
        },
    },
    mounted() {
        this.getDataList();
    },
};
</script>

<style></style>
